package com.simple.accounting.utils;

import java.math.BigDecimal;

public class FloatUtils {

    /*进行除法运算，保留4位小数*/
    public static float div(float value1, float value2) {
        float value3 = value1 / value2;
        BigDecimal bigDecimal1 = new BigDecimal(value3);
        return bigDecimal1.setScale(4, 4).floatValue();
    }

    /*将浮点数类型，转换成百分比显示形式*/
    public static String ratioToPercent(float value) {
        float v = value * 100;
        BigDecimal b1 = new BigDecimal(v);
        float v1 = b1.setScale(2, 4).floatValue();
        return v1 + "%";

    }
}
